using System;
using System.Collections;

namespace SqInterface
{
	/// <summary>
	/// Summary description for Squirrel.
	/// </summary>
	public class Squirrel
	{
		static Hashtable _vms = new Hashtable();
		public Squirrel()
		{
			// this class is pretty much all static
		}

		public static SqVM CreateVM( int StackHint )
		{
			SqVM vm = new SqVM( StackHint );
			_vms.Add( vm.VM, vm );
			return vm;
		}

		public static bool DestroyVM( SqVM vm )
		{
			if ( !HasVM( vm.VM ) )
				return false;
			_vms.Remove( vm.VM );
			return true;
		}

		public static bool HasVM( IntPtr vmref )
		{
			return _vms.ContainsKey( vmref );
		}
		public static bool HasVM( SqVM vm )
		{
			return HasVM( vm.VM );
		}

		public static SqVM GetVM( IntPtr vmref )
		{
			return (SqVM)_vms[vmref];
		}
	}
}
